<div class="logo">
<a href="index.php"><img src="images/logo.jpg" title="logo"  />
</a>
</div>
<?php
$phpmongo = new Phpmongo();
$dbList = $phpmongo->dbList();
?>
<div class="menu_db">
	Database
	<br /><br />

	<ul id="menu_db_li">
		<?php 
		if (is_array($dbList) && !empty($dbList)):
			foreach ($dbList as $db):
			$count = $phpmongo->countCollection($db['name']);
		?>
			<li>
			<a <?php if ($_GET['db'] == $db['name']) echo 'style="color: #000;"';?>
		 id="li_db_<?php echo $db['name'];?>" href="db.php?db=<?php echo $db['name'];?>" ><?php echo $db['name'] .' 
		<lable class="lable">('.$count.')</lable>';?>
			</a>
			<ul class="sub_menu_db">
			<?php
			if ($_GET['db'] == $db['name']):
				$collections = $phpmongo->getCollection($db['name']);
				foreach ($collections as $collection):
			?>
				<li <?php if ($_GET['collection']==$collection){echo 'style="background-color:#CCFFCC;display:bolok;font-weight:bold;"';}?>>
				<a style="color:#000;font-weight:normal;" 
			href="collection.php?db=<?php echo $db['name'];?>&collection=<?php echo $collection;?>">
				<?php echo $collection;?></a></li>
			<?php	
				endforeach;
			endif;
			?>
			</ul>
			</li>
		<?php		
			endforeach;
		endif;
		?>			
	</ul>

</div>
